#!/usr/bin/env python
# -*- coding: utf-8 -*-

from config import etc
from sqlalchemy.engine import create_engine

# 创建到数据库的连接,echo=True表示用logging输出调试结果
# pool_recycle: this setting causes the pool to recycle connections after the given number of seconds has passed. It defaults to -1, or no timeout.
# (MySQL in particular will disconnect automatically if no activity is detected on a connection for eight hours) interactive_timeout and wait_timeout --show global variables like '%timeout';
engine = create_engine('mysql://' + etc.mysql_user + ':' + etc.mysql_passwd + '@' + etc.mysql_host + ':' + str(
    etc.mysql_port) + '/' + 'test' + '?charset=utf8mb4', encoding="utf-8", pool_size=100, pool_recycle=3600, echo=True)
